#include<iostream>

using namespace std;

int parity_check(const unsigned char* msg, const int msg_length,bool isOdd) {
	int check = 0;
	for (int i = 0; i < msg_length; i++) {
		char c = msg[i];
		for (int i = 0; i < 8; i++) {
			int this_bit = c >> i & 1;
			check ^= this_bit;
		}
		if (isOdd && check == 0) return 0;
		if (!isOdd && check == 1)return 0;
	}
	return true;
}
